package io;

import java.io.*;

/**
 * @description: 字节复制文件
 * @author apple
 * @date 2021/9/12 12:34 上午
 * @version 1.0
 */
public class ByteCopyDemo {

    public static void main(String[] args) throws IOException {

        File src = new File("/Users/apple/tx.txt");
        File desc = new File("tx2.txt");

        InputStream in = new FileInputStream(src);
        OutputStream out = new FileOutputStream(desc);
        byte[] buffs = new byte[1024];
        int len = 0;
        while ((len = in.read(buffs)) != -1) {
            out.write(buffs);
        }
        out.close();
        in.close();

    }
}
